{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " Licensed to the Apache Software Foundation (ASF) under one\n",
    " or more contributor license agreements.  See the NOTICE file\n",
    " distributed with this work for additional information\n",
    " regarding copyright ownership.  The ASF licenses this file\n",
    " to you under the Apache License, Version 2.0 (the\n",
    " \"License\"); you may not use this file except in compliance\n",
    " with the License.  You may obtain a copy of the License at\n",
    "\n",
    "   http://www.apache.org/licenses/LICENSE-2.0\n",
    "\n",
    " Unless required by applicable law or agreed to in writing,\n",
    " software distributed under the License is distributed on an\n",
    " \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n",
    " KIND, either express or implied.  See the License for the\n",
    " specific language governing permissions and limitations\n",
    " under the License."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This is an example jupyter notebook for Apache Airflow that shows how to use\n",
    "papermill in combination with scrapbook"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import scrapbook as sb"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The parameter tag for cells is used to tell papermill where it can find variables it needs to set"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "tags": [
     "parameters"
    ]
   },
   "outputs": [],
   "source": [
    "msgs = \"Hello!\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Inside the notebook you can save data by calling the glue function. Then later you can read the results of that notebook by “scrap” name (see the Airflow Papermill example DAG)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/scrapbook.scrap.text+json": {
       "data": "Hello!",
       "encoder": "text",
       "name": "message",
       "version": 1
      }
     },
     "metadata": {
      "scrapbook": {
       "data": true,
       "display": false,
       "name": "message"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "sb.glue('message', msgs)"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Tags",
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
